package com.ft.admix.gdt.adapter;

import android.content.Context;

import com.bytedance.sdk.openadsdk.TTAdConfig;
import com.bytedance.sdk.openadsdk.TTAdSdk;
import com.ft.adbix.core.common.ErrorCode;
import com.ft.admix.base.ADMixAdapterIniter;
import com.ft.admix.config.PlatformConfig;
import com.qq.e.comm.managers.GDTAdSdk;

public class AdIniter extends ADMixAdapterIniter {

    @Override
    public void initialize(Context context, PlatformConfig config) {
        //4.560.1430及以后版本
        GDTAdSdk.initWithoutStart(context.getApplicationContext(), config.getAppId()); // 该接口不会采集用户信息
// 调用initWithoutStart后请尽快调用start，否则可能影响广告填充，造成收入下降
        GDTAdSdk.start(new GDTAdSdk.OnStartListener() {
            @Override
            public void onStartSuccess() {
                callInitSuccess();
            }

            @Override
            public void onStartFailed(Exception e) {
                callInitFailed(ErrorCode.ERROR_NOT_INIT,e.toString());
            }
        });
    }

    @Override
    public String platformName() {
        return "GDT";
    }
}
